package cn.blnp.net.flowable.api.identity;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.*;
import org.flowable.idm.api.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;

/**
 * <h3>身份服务API演示案例</h3>
 *
 * @author <a href="mailto:blnp.yibin@qq.com">lyb</a>
 * @version 1.0
 * @since 2025/4/30 11:42
 */
@Slf4j
@SpringBootTest
public class IdentityApiTest {

    @Resource
    private ManagementService managementService;
    @Resource
    private RepositoryService repositoryService;
    @Resource
    private HistoryService historyService;
    @Resource
    private TaskService taskService;
    @Resource
    private RuntimeService runtimeService;
    @Resource
    private IdentityService identityService;

    @Test
    public void test() {
        /**
         *  Flowable使用ACT_ID_GROUP、ACT_ID_USER、ACT_ID_INFO和ACT_ID_MEMBERSHIP这4张表维护人员组织架构。身份服务接口IdentityService负责提供用户、组和人员组织关系管理等服务。
         **/
        //新建用户
        //User newUser(String userId);

        //保存用户
        //void saveUser(User user);

        //更新密码
        //void updateUserPassword(User user);

        //创建用户查询
        //UserQuery createUserQuery();

        //创建本地SQL查询
        //NativeUserQuery createNativeUserQuery();

        //删除用户
        //void deleteUser(String userId);

        //检查指定密码与用户密码是否一致
        //boolean checkPassword(String userId, String password);

        //设置当前环境下的认证用户ID
        //void setAuthenticatedUserId(String authenticatedUserId);

        //设置用户图片
        //void setUserPicture(String userId, Picture picture);

        //获取用户图片
        //Picture getUserPicture(String userId);

        //新建组
        //Group newGroup(String groupId);

        //创建组查询对象
        //GroupQuery createGroupQuery();

        //创建本地组SQL查询
        //NativeGroupQuery createNativeGroupQuery();

        //查询指定流程定义ID上配置的发起小组
        //List<Group> getPotentialStarterGroups(String processDefinitionId);

        //查询指定流程定义ID上配置的发起用户
        //List<User> getPotentialStarterUsers(String processDefinitionId);

        //保存组
        //void saveGroup(Group group);

        //删除组
        //void deleteGroup(String groupId);

        //创建用户与组的关系
        //void createMembership(String userId, String groupId);

        //删除用户与组的关系
        //void deleteMembership(String userId, String groupId);

        //设置用户扩展信息
        //void setUserInfo(String userId, String key, String value);

        //查询用户指定key的扩展信息
        //String getUserInfo(String userId, String key);

        //查询用户所有扩展信息的key
        //List<String> getUserInfoKeys(String userId);

        //删除用户某个key的扩展信息
        //void deleteUserInfo(String userId, String key);
    }
}
